package com.fingard.dsp.bank.reqrespobj.billpool;

import com.fingard.constant.Format;
import com.fingard.dsp.bank.reqrespobj.ReqRespHeader;
import com.fingard.dsp.bank.reqrespobj.RequestBase;
import com.fingard.dsp.bank.reqrespobj.billpool.Detail.ReqB324InPoolRegisterDetail;
import com.fingard.xml.XmlTextReader;

import java.text.ParseException;
import java.util.Date;

public class ReqB324InPoolRegister extends RequestBase {
    public ReqB324InPoolRegisterDetail reqDetail = null;
    //交易起始日期  入池时间开始日期 yyyy-MM-dd
    public String BeginDate;
    //交易终止日期 入池时间结束日期  yyyy-MM-dd
    public String EndDate;
    //票据介质 1-纸票  2-电票
    public String Billmedium;
    //入池方式 01-托管   02-质押
    public String Outintype;
    //票据状态 00-在库  01-托收在途
    public String Billstatus;
    //是否整池查询 0-是 1-否
    public String IsPoolQry;
    //池编号
    public String BillPoolNo;


    //    到期日上限 yyyy-MM-dd
    public String BillDateTopLimit;
    //    到期日下限 yyyy-MM-dd
    public String BillDateLowLimit;
    //    出票起始日 yyyy-MM-dd
    public String OutBillBeginDate;
    //    出票终止日 yyyy-MM-dd
    public String OutBillEndDate;
    //    票据金额上限
    public String BillMoneyTopLimit;
    //    票据金额下限
    public String BillMoneyLowLimit;
    //    票据类型 1-银承 2-商承
    public String BillType;
    //    收支标志 0-应收 1-应付
    public String PayReceiveFlag;

    private XmlTextReader xmlReader;

    public boolean readRecord() throws Exception {
        reqDetail = null;
        if (xmlReader.read(PATH_Detail)) {
            reqDetail = new ReqB324InPoolRegisterDetail(xmlReader.readedXElement);
            return true;
        } else {
            return false;
        }
    }

    public ReqB324InPoolRegister(XmlTextReader p_xmlReader, ReqRespHeader p_header) throws Exception {
        reqHeader = p_header;
        xmlReader = p_xmlReader;
        BeginDate = xmlReader.getSimpleText("BeginDate");
        EndDate = xmlReader.getSimpleText("EndDate");
        Billmedium = xmlReader.getSimpleText("Billmedium");
        BillType = xmlReader.getSimpleText("BillType");
        Outintype = xmlReader.getSimpleText("Outintype");
        Billstatus = xmlReader.getSimpleText("Billstatus");
        IsPoolQry = xmlReader.getSimpleText("IsPoolQry");
        BillPoolNo = xmlReader.getSimpleText("BillPoolNo");
        BillDateTopLimit = xmlReader.getSimpleText("BillDateTopLimit");
        BillDateLowLimit = xmlReader.getSimpleText("BillDateLowLimit");
        OutBillBeginDate = xmlReader.getSimpleText("OutBillBeginDate");
        OutBillEndDate = xmlReader.getSimpleText("OutBillEndDate");
        BillMoneyTopLimit = xmlReader.getSimpleText("BillMoneyTopLimit");
        BillMoneyLowLimit = xmlReader.getSimpleText("BillMoneyLowLimit");
        BillType = xmlReader.getSimpleText("BillType");
        PayReceiveFlag = xmlReader.getSimpleText("PayReceiveFlag");

    }
    public Date getBeginDate() throws ParseException {
        return Format.Date10Format.parse(BeginDate);
    }

    public Date getEndDate() throws ParseException {
        return Format.Date10Format.parse(EndDate);
    }
}
